﻿@model List<User>
<table class="table">
    <thead>
        <tr>
            <th>姓名</th>
            <th>邮箱</th>
            <th>状态</th>
            <th>角色</th>
            <th>创建时间</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>@item.RealName</td>
                <td>@item.Email</td>
                <th>@if (!item.Enabled) { <span>已禁用</span>}</th>
                <td>@item.Roles</td>
                <td>@item.CreateTime</td>
                <td><a href="javascript:;" data-api="/api/user/enable?id=@item.ID">启用</a> | <a href="/user/setpassword?id=@item.ID&returnUrl=@Context.Request.PathAndQuery()">设置密码</a></td>
            </tr>
        }
    </tbody>
</table>
@section scripts{
    <script>
        $('a[data-api]').click(function () {
            var api = $(this).data('api');
            $.post(api, function () {
                location.reload();
            });
        });
    </script>
}